$:.unshift File.join(File.dirname(__FILE__),'../..','src')

# A Ship is specified as being of a certain size, which is implemented as a
# collection of compartments.  The compartments are used to track the location
# of the ship on the grid (with each compartment occupying one square), and to
# track the health of the ship.
class ShipCompartment

	def initialize(index)
		@index = index
		@alive = true
	end

  # Registers a hit against a ship compartment, which kills that compartment.
  public
	def hit
		@alive = false
	end

  # Queries the compartment to determine if it has been hit or not.
  public
  def alive?
    @alive
  end

  # Gets the sequential index of this compartment within its host Ship
  public
  def index
    @index
  end

end